grammar SL;

options {
  language = Python;
}

simple_statement : expr
                 | var_def
                 | func_call
                 | auassign
                 ;

auassign : ID ('+='|'-='|'*='|'/=') expr ;

func_call : ID '(' (atom (',' atom)*)? ')';

expr: multi_expr (('+'|'-') multi_expr)*;

multi_expr: atom (('*'|'/') atom)* ;

atom : ID 
     | INT
     | '(' expr ')'
     ;

var_def : type (ID|assign) (',' (ID|assign))* ';';

assign : ID '=' expr;

type: 'int'
    | 'string'
    | 'set'
    | 'element'
    | 'bool'
    ;

ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
INT : '1'..'9' ('0'..'9')*;
STRING : '"'(~('"'))*'"';
WS : (' '|'\t'|'\r'|'\n')+ {$channel=HIDDEN;};
